import 'package:flutter/material.dart';
import 'package:osc/common/MyTextStyle.dart';
import 'package:osc/models/entity/osc_user.dart';
import 'package:osc/res/dimens.dart';
import 'package:osc/utils/pd_util.dart';

import '../small_widgets.dart';

class OscTweetPickUserWidget extends StatelessWidget {
  final OscUser user;
  final bool showCheckBox;
  final Function onTap;

  const OscTweetPickUserWidget({Key key, @required this.user, @required this.onTap, this.showCheckBox = false}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: EdgeInsets.symmetric(vertical: Dimens.gap_view_normal, horizontal: Dimens.gap_view_big),
        color: Colors.white,
        child: Row(
          children: <Widget>[
            Offstage(
              offstage: !showCheckBox,
              child: Image.asset(PdUtil.getImagePath(user.checked? "form_checkbox_checked" : "form_checkbox_normal"), width: Dimens.view_item_icon_height_big, fit: BoxFit.contain,),
            ),
            SmallWidgets.buildCircleImage(url: user.portrait, width: Dimens.view_portrait_size_small, height: Dimens.view_portrait_size_small, fit: BoxFit.contain),
            Padding(
                padding: EdgeInsets.only(left: Dimens.gap_view_big),
              child: Text(user.name, style: MyTextStyle.USER_LIST_TITLE,),
            ),
          ],
        ),
      ),
    );
  }
}
